package android.BigCity;

import java.util.Date;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.Spinner;
import android.widget.TextView;

import android.activity.R;
/*
 * klasa za formiranje na testot i funkcii povrzani so nego
 */
public class Prasanja extends Activity{
	
	String name="";	
	Spinner spinner1;
	Spinner spinner2;
	Spinner spinner3;
	Spinner spinner4;
	Spinner spinner5;
	Spinner spinner6;
	
	String spREZ1="";
	String spREZ2="";
	String spREZ3="";
	String spREZ4="";
	String spREZ5="";
	String spREZ6="";
	android.database.DBAdapter db = new android.database.DBAdapter(this); 
	Date data = new Date();
	
		

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.prasanja);
		
		
		Bundle extras=getIntent().getExtras();
		if(extras!=null)
		{
			name = extras.getString("ime");	//go zema imeto na selektiranata lekcija		
		}
		TextView lblNaslov=(TextView)findViewById(R.id.aaaa);
		lblNaslov.setText(name);
		
		 //spored prenesenite podatoci se izvrsuvaat istite f-cii no so razlicna sodrzina
				
		if(name.equals("Episode 1 - Nice to meet you"))
		{
			setContentView(R.layout.episode1);	
			
			Button btnRez1=(Button)findViewById(R.id.btnResult1);			
			Button btnAns1=(Button)findViewById(R.id.btnAns);
			
			OnClickListener btnListener = new OnClickListener() {
				
				@Override
				//f-cija za prikazuvanje na rezultatot od testiranjeto
				//i davanje na soodveten sovet spored osvoenite bodovi
				public void onClick(View v) {
					// TODO Auto-generated method stub
					int rez = Rezultat1();
					String suggest = "";
					if(rez <= 5)suggest="BEGGINER\nYour knowledge is very low. You must work\nharder to achieve results. First, repeat\nthe previous lessons and start again with\nthe last lesson.";
					else if (rez <=13)suggest="ELEMETARY\nYou have a good but not enough knowledge. \nIf you want to improve your knowledge, \nyou are advised to return to the previous\nlesson and then start again with the last\nlesson.";
					else if (rez <= 20)suggest="INTERMEDIATE\nYou possess great knowledge. But always \ncan better, so if you want repeat the \nlast lesson and do the test again";
					else if (rez < 24)suggest="EXELENT\nGreat job. You are able to proceed further";
					else if(rez == 24) suggest="EXPERT\nYou do all the work. Brilliant";
					
					TextView lblSUG = (TextView)findViewById(R.id.lblSUG);
					lblSUG.setText(suggest);
					TextView lblREZ=(TextView)findViewById(R.id.lblREZ);
					lblREZ.setText("Your score is " + Rezultat1()+"/24");
					String pom = String.valueOf(Rezultat1());
					String pom1=String.valueOf(data.getDay());
			        String pom2=String.valueOf(data.getMonth());
			        String pom3=String.valueOf(data.getYear());
					
			        //zacuvuvanje na rezultatot vo baza na podatoci
					db.open();        
			        long id = db.insertScore("Episode 1",pom1+"."+pom2+"."+pom3.substring(1), pom+"/24");  
			        db.close();
				}
			};			
			btnRez1.setOnClickListener(btnListener);
			
			/*
			 * f-ja za prikazuvanje na tocnite resenija na prasanjata od testot
			 */
			OnClickListener btnListener1 = new OnClickListener() {
				
				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					TextView lblSUG = (TextView)findViewById(R.id.lblSUG);
					lblSUG.setText(R.string.answers1);
					TextView lblREZ=(TextView)findViewById(R.id.lblREZ);
					lblREZ.setText("Answers:");
				}
			};			
			btnAns1.setOnClickListener(btnListener1);
			
		}
		else if(name.equals("Episode 2 - Get a piece of the action"))
		{
			setContentView(R.layout.episode2);
			
			Button btnRez2=(Button)findViewById(R.id.btnResult2);
			Button btnAns1=(Button)findViewById(R.id.btnAns);
			
			OnClickListener btnListener2 = new OnClickListener() {
				
				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					int rez = Rezultat2();
					String suggest = "";
					if(rez <= 6)suggest="BEGGINER\nYour knowledge is very low. You must work\nharder to achieve results. First, repeat\nthe previous lessons and start again with\nthe last lesson.";
					else if (rez <=15)suggest="ELEMETARY\nYou have a good but not enough knowledge. \nIf you want to improve your knowledge, \nyou are advised to return to the previous\nlesson and then start again with the last\nlesson.";
					else if (rez <= 23)suggest="INTERMEDIATE\nYou possess great knowledge. But always \ncan better, so if you want repeat the \nlast lesson and do the test again";
					else if (rez < 28)suggest="EXELENT\nGreat job. You are able to proceed further";
					else if(rez == 28) suggest="EXPERT\nYou do all the work. Brilliant";
					
					TextView lblSUG = (TextView)findViewById(R.id.lblSUG);
					lblSUG.setText(suggest);
					TextView lblREZ=(TextView)findViewById(R.id.lblREZ);					
					lblREZ.setText("Your score is " + Rezultat2()+"/28");
					String pom = String.valueOf(Rezultat2());
					String pom1=String.valueOf(data.getDay());
			        String pom2=String.valueOf(data.getMonth());
			        String pom3=String.valueOf(data.getYear());
					
					db.open();        
			        long id = db.insertScore("Episode 2",pom1+"."+pom2+"."+pom3.substring(1), pom+"/28");  
			        db.close();
				}
			};			
			btnRez2.setOnClickListener(btnListener2);
			
			OnClickListener btnListener1 = new OnClickListener() {
				
				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					TextView lblSUG = (TextView)findViewById(R.id.lblSUG);
					lblSUG.setText(R.string.answers2);
					TextView lblREZ=(TextView)findViewById(R.id.lblREZ);
					lblREZ.setText("Answers:");
				}
			};			
			btnAns1.setOnClickListener(btnListener1);
			
		}
		else if(name.equals("Episode 3 - I have been kicked out"))
		{
			setContentView(R.layout.episode3);	
			
			Button btnRez3=(Button)findViewById(R.id.btnResult3);
			Button btnAns1=(Button)findViewById(R.id.btnAns);
			
			OnClickListener btnListener3 = new OnClickListener() {
				
				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					int rez = Rezultat3();
					String suggest = "";
					if(rez <= 5)suggest="BEGGINER\nYour knowledge is very low. You must work\nharder to achieve results. First, repeat\nthe previous lessons and start again with\nthe last lesson.";
					else if (rez <=10)suggest="ELEMETARY\nYou have a good but not enough knowledge. \nIf you want to improve your knowledge, \nyou are advised to return to the previous\nlesson and then start again with the last\nlesson.";
					else if (rez <= 18)suggest="INTERMEDIATE\nYou possess great knowledge. But always \ncan better, so if you want repeat the \nlast lesson and do the test again";
					else if (rez < 22)suggest="EXELENT\nGreat job. You are able to proceed further";
					else if(rez == 22) suggest="EXPERT\nYou do all the work. Brilliant";
					
					TextView lblSUG = (TextView)findViewById(R.id.lblSUG);
					lblSUG.setText(suggest);
					TextView lblREZ=(TextView)findViewById(R.id.lblREZ);					
					lblREZ.setText("Your score is " + Rezultat3()+"/22");
					String pom = String.valueOf(Rezultat3());
					String pom1=String.valueOf(data.getDay());
			        String pom2=String.valueOf(data.getMonth());
			        String pom3=String.valueOf(data.getYear());
					
					db.open();        
			        long id = db.insertScore("Episode 3",pom1+"."+pom2+"."+pom3.substring(1), pom+"/22");  
			        db.close();
				}
			};			
			btnRez3.setOnClickListener(btnListener3);
			
			OnClickListener btnListener1 = new OnClickListener() {
				
				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					TextView lblSUG = (TextView)findViewById(R.id.lblSUG);
					lblSUG.setText(R.string.answers3);
					TextView lblREZ=(TextView)findViewById(R.id.lblREZ);
					lblREZ.setText("Answers:");
				}
			};			
			btnAns1.setOnClickListener(btnListener1);
			
		}
		else if(name.equals("Episode 4 - We have a mission"))
		{
			setContentView(R.layout.episode4);
			
			//kreiranje na elementite od spinner_dropdown listata
			spinner1 = (Spinner) findViewById(R.id.spE4_1_1);
		    ArrayAdapter<CharSequence> adapter1 = ArrayAdapter.createFromResource(
		            this, R.array.spE4_1_array, android.R.layout.simple_spinner_item);
		    adapter1.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
		    spinner1.setAdapter(adapter1);
		    
		    
		    spinner2 = (Spinner) findViewById(R.id.spE4_1_2);
		    ArrayAdapter<CharSequence> adapter2 = ArrayAdapter.createFromResource(
		            this, R.array.spE4_1_array, android.R.layout.simple_spinner_item);
		    adapter2.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
		    spinner2.setAdapter(adapter2);
		    
		    
		    spinner3 = (Spinner) findViewById(R.id.spE4_1_3);
		    ArrayAdapter<CharSequence> adapter3 = ArrayAdapter.createFromResource(
		            this, R.array.spE4_1_array, android.R.layout.simple_spinner_item);
		    adapter3.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
		    spinner3.setAdapter(adapter3);
		    
		    
		    
		    spinner4 = (Spinner) findViewById(R.id.spE4_1_4);
		    ArrayAdapter<CharSequence> adapter4 = ArrayAdapter.createFromResource(
		            this, R.array.spE4_1_array, android.R.layout.simple_spinner_item);
		    adapter4.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
		    spinner4.setAdapter(adapter4);
		    
		    
		    spinner5 = (Spinner) findViewById(R.id.spE4_1_5);
		    ArrayAdapter<CharSequence> adapter5 = ArrayAdapter.createFromResource(
		            this, R.array.spE4_1_array, android.R.layout.simple_spinner_item);
		    adapter5.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
		    spinner5.setAdapter(adapter5);
		    
		    
		    
		    spinner6 = (Spinner) findViewById(R.id.spE4_1_6);
		    ArrayAdapter<CharSequence> adapter6 = ArrayAdapter.createFromResource(
		            this, R.array.spE4_1_array, android.R.layout.simple_spinner_item);
		    adapter6.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
		    spinner6.setAdapter(adapter6);
		   /*
		    * f-ja za postavuvanje na selektiraniot element 
		    */
		    OnItemSelectedListener spListener1= new OnItemSelectedListener() {

				@Override
				public void onItemSelected(AdapterView<?> arg0, View arg1,
						int arg2, long arg3) {
					// TODO Auto-generated method stub
					spREZ1 = arg0.getItemAtPosition(arg2).toString();
				}    
					    
				@Override
				public void onNothingSelected(AdapterView<?> arg0) {
					// TODO Auto-generated method stub
					
				}
			};
			OnItemSelectedListener spListener2= new OnItemSelectedListener() {

				@Override
				public void onItemSelected(AdapterView<?> arg0, View arg1,
						int arg2, long arg3) {
					// TODO Auto-generated method stub
					spREZ2 = arg0.getItemAtPosition(arg2).toString();
				}    
					    
				@Override
				public void onNothingSelected(AdapterView<?> arg0) {
					// TODO Auto-generated method stub
					
				}
			};
			OnItemSelectedListener spListener3= new OnItemSelectedListener() {

				@Override
				public void onItemSelected(AdapterView<?> arg0, View arg1,
						int arg2, long arg3) {
					// TODO Auto-generated method stub
					spREZ3 = arg0.getItemAtPosition(arg2).toString();
				}    
					    
				@Override
				public void onNothingSelected(AdapterView<?> arg0) {
					// TODO Auto-generated method stub
					
				}
			};
			OnItemSelectedListener spListener4= new OnItemSelectedListener() {

				@Override
				public void onItemSelected(AdapterView<?> arg0, View arg1,
						int arg2, long arg3) {
					// TODO Auto-generated method stub
					spREZ4 = arg0.getItemAtPosition(arg2).toString();
				}    
					    
				@Override
				public void onNothingSelected(AdapterView<?> arg0) {
					// TODO Auto-generated method stub
					
				}
			};
			OnItemSelectedListener spListener5= new OnItemSelectedListener() {

				@Override
				public void onItemSelected(AdapterView<?> arg0, View arg1,
						int arg2, long arg3) {
					// TODO Auto-generated method stub
					spREZ5 = arg0.getItemAtPosition(arg2).toString();
				}    
					    
				@Override
				public void onNothingSelected(AdapterView<?> arg0) {
					// TODO Auto-generated method stub
					
				}
			};
			OnItemSelectedListener spListener6= new OnItemSelectedListener() {

				@Override
				public void onItemSelected(AdapterView<?> arg0, View arg1,
						int arg2, long arg3) {
					// TODO Auto-generated method stub
					spREZ6 = arg0.getItemAtPosition(arg2).toString();
				}    
					    
				@Override
				public void onNothingSelected(AdapterView<?> arg0) {
					// TODO Auto-generated method stub
					
				}
			};
			

			spinner1.setOnItemSelectedListener(spListener1);
			spinner2.setOnItemSelectedListener(spListener2);
			spinner3.setOnItemSelectedListener(spListener3);
			spinner4.setOnItemSelectedListener(spListener4);
			spinner5.setOnItemSelectedListener(spListener5);
			spinner6.setOnItemSelectedListener(spListener6);
			
			
		    Button btnRez4=(Button)findViewById(R.id.btnResult4);
		    Button btnAns1=(Button)findViewById(R.id.btnAns);
			
			OnClickListener btnListener4 = new OnClickListener() {
				
				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					int rez = Rezultat4();
					String suggest = "";
					if(rez <= 5)suggest="BEGGINER\nYour knowledge is very low. You must work\nharder to achieve results. First, repeat\nthe previous lessons and start again with\nthe last lesson.";
					else if (rez <=12)suggest="ELEMETARY\nYou have a good but not enough knowledge. \nIf you want to improve your knowledge, \nyou are advised to return to the previous\nlesson and then start again with the last\nlesson.";
					else if (rez <= 19)suggest="INTERMEDIATE\nYou possess great knowledge. But always \ncan better, so if you want repeat the \nlast lesson and do the test again";
					else if (rez < 23)suggest="EXELENT\nGreat job. You are able to proceed further";
					else if(rez == 23) suggest="EXPERT\nYou do all the work. Brilliant";
					
					TextView lblSUG = (TextView)findViewById(R.id.lblSUG);
					lblSUG.setText(suggest);
					TextView lblREZ=(TextView)findViewById(R.id.lblREZ);					
					lblREZ.setText("Your score is " + Rezultat4()+"/23");
					String pom = String.valueOf(Rezultat4());
					String pom1=String.valueOf(data.getDay());
			        String pom2=String.valueOf(data.getMonth());
			        String pom3=String.valueOf(data.getYear());
					
					db.open();        
			        long id = db.insertScore("Episode 4",pom1+"."+pom2+"."+pom3.substring(1), pom+"/23");  
			        db.close();
				}
			};						
			
			btnRez4.setOnClickListener(btnListener4);
			
			OnClickListener btnListener1 = new OnClickListener() {
				
				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					TextView lblSUG = (TextView)findViewById(R.id.lblSUG);
					lblSUG.setText(R.string.answers4);
					TextView lblREZ=(TextView)findViewById(R.id.lblREZ);
					lblREZ.setText("Answers:");
				}
			};			
			btnAns1.setOnClickListener(btnListener1);
		    
		}
		else if(name.equals("Episode 5 - Why are you looking so glum?"))
		{
			setContentView(R.layout.episode5);
			
			Button btnRez5=(Button)findViewById(R.id.btnResult5);
			Button btnAns1=(Button)findViewById(R.id.btnAns);
			
			OnClickListener btnListener5 = new OnClickListener() {
				
				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					int rez = Rezultat5();
					String suggest = "";
					if(rez <= 6)suggest="BEGGINER\nYour knowledge is very low. You must work\nharder to achieve results. First, repeat\nthe previous lessons and start again with\nthe last lesson.";
					else if (rez <=15)suggest="ELEMETARY\nYou have a good but not enough knowledge. \nIf you want to improve your knowledge, \nyou are advised to return to the previous\nlesson and then start again with the last\nlesson.";
					else if (rez <= 23)suggest="INTERMEDIATE\nYou possess great knowledge. But always \ncan better, so if you want repeat the \nlast lesson and do the test again";
					else if (rez < 27)suggest="EXELENT\nGreat job. You are able to proceed further";
					else if(rez == 27) suggest="EXPERT\nYou do all the work. Brilliant";
					
					TextView lblSUG = (TextView)findViewById(R.id.lblSUG);
					lblSUG.setText(suggest);
					TextView lblREZ=(TextView)findViewById(R.id.lblREZ);					
					lblREZ.setText("Your score is " + Rezultat5()+"/27");
					String pom = String.valueOf(Rezultat5());
					String pom1=String.valueOf(data.getDay());
			        String pom2=String.valueOf(data.getMonth());
			        String pom3=String.valueOf(data.getYear());
					
					db.open();        
			        long id = db.insertScore("Episode 5",pom1+"."+pom2+"."+pom3.substring(1), pom+"/27");  
			        db.close();
				}
			};			
			btnRez5.setOnClickListener(btnListener5);
			
			OnClickListener btnListener1 = new OnClickListener() {
				
				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					TextView lblSUG = (TextView)findViewById(R.id.lblSUG);
					lblSUG.setText(R.string.answers5);
					TextView lblREZ=(TextView)findViewById(R.id.lblREZ);
					lblREZ.setText("Answers:");
				}
			};			
			btnAns1.setOnClickListener(btnListener1);
			
		}
		else if(name.equals("Episode 6 - He is a pest"))
		{
			setContentView(R.layout.episode6);
			
			spinner1 = (Spinner) findViewById(R.id.spE6_2_1);
		    ArrayAdapter<CharSequence> adapter1 = ArrayAdapter.createFromResource(
		            this, R.array.spE6_2_array, android.R.layout.simple_spinner_item);
		    adapter1.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
		    spinner1.setAdapter(adapter1);
		    
		    
		    spinner2 = (Spinner) findViewById(R.id.spE6_2_2);
		    ArrayAdapter<CharSequence> adapter2 = ArrayAdapter.createFromResource(
		            this, R.array.spE6_2_array, android.R.layout.simple_spinner_item);
		    adapter2.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
		    spinner2.setAdapter(adapter2);
		    
		    
		    spinner3 = (Spinner) findViewById(R.id.spE6_2_3);
		    ArrayAdapter<CharSequence> adapter3 = ArrayAdapter.createFromResource(
		            this, R.array.spE6_2_array, android.R.layout.simple_spinner_item);
		    adapter3.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
		    spinner3.setAdapter(adapter3);
		    
		    
		    
		    spinner4 = (Spinner) findViewById(R.id.spE6_2_4);
		    ArrayAdapter<CharSequence> adapter4 = ArrayAdapter.createFromResource(
		            this, R.array.spE6_2_array, android.R.layout.simple_spinner_item);
		    adapter4.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
		    spinner4.setAdapter(adapter4);
		    
		    
		    OnItemSelectedListener spListener1= new OnItemSelectedListener() {

				@Override
				public void onItemSelected(AdapterView<?> arg0, View arg1,
						int arg2, long arg3) {
					// TODO Auto-generated method stub
					spREZ1 = arg0.getItemAtPosition(arg2).toString();
				}    
					    
				@Override
				public void onNothingSelected(AdapterView<?> arg0) {
					// TODO Auto-generated method stub
					
				}
			};
			OnItemSelectedListener spListener2= new OnItemSelectedListener() {

				@Override
				public void onItemSelected(AdapterView<?> arg0, View arg1,
						int arg2, long arg3) {
					// TODO Auto-generated method stub
					spREZ2 = arg0.getItemAtPosition(arg2).toString();
				}    
					    
				@Override
				public void onNothingSelected(AdapterView<?> arg0) {
					// TODO Auto-generated method stub
					
				}
			};
			OnItemSelectedListener spListener3= new OnItemSelectedListener() {

				@Override
				public void onItemSelected(AdapterView<?> arg0, View arg1,
						int arg2, long arg3) {
					// TODO Auto-generated method stub
					spREZ3 = arg0.getItemAtPosition(arg2).toString();
				}    
					    
				@Override
				public void onNothingSelected(AdapterView<?> arg0) {
					// TODO Auto-generated method stub
					
				}
			};
			OnItemSelectedListener spListener4= new OnItemSelectedListener() {

				@Override
				public void onItemSelected(AdapterView<?> arg0, View arg1,
						int arg2, long arg3) {
					// TODO Auto-generated method stub
					spREZ4 = arg0.getItemAtPosition(arg2).toString();
				}    
					    
				@Override
				public void onNothingSelected(AdapterView<?> arg0) {
					// TODO Auto-generated method stub
					
				}
			};			

			spinner1.setOnItemSelectedListener(spListener1);
			spinner2.setOnItemSelectedListener(spListener2);
			spinner3.setOnItemSelectedListener(spListener3);
			spinner4.setOnItemSelectedListener(spListener4);
		    
		    Button btnRez6=(Button)findViewById(R.id.btnResult6);
		    Button btnAns1=(Button)findViewById(R.id.btnAns);
			
			OnClickListener btnListener6 = new OnClickListener() {
				
				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					int rez = Rezultat6();
					String suggest = "";
					if(rez <= 5)suggest="BEGGINER\nYour knowledge is very low. You must work\nharder to achieve results. First, repeat\nthe previous lessons and start again with\nthe last lesson.";
					else if (rez <=13)suggest="ELEMETARY\nYou have a good but not enough knowledge. \nIf you want to improve your knowledge, \nyou are advised to return to the previous\nlesson and then start again with the last\nlesson.";
					else if (rez <= 20)suggest="INTERMEDIATE\nYou possess great knowledge. But always \ncan better, so if you want repeat the \nlast lesson and do the test again";
					else if (rez < 24)suggest="EXELENT\nGreat job. You are able to proceed further";
					else if(rez == 24) suggest="EXPERT\nYou do all the work. Brilliant";
					
					TextView lblSUG = (TextView)findViewById(R.id.lblSUG);
					lblSUG.setText(suggest);
					TextView lblREZ=(TextView)findViewById(R.id.lblREZ);					
					lblREZ.setText("Your score is " + Rezultat6()+"/24");
					String pom = String.valueOf(Rezultat6());
					String pom1=String.valueOf(data.getDay());
			        String pom2=String.valueOf(data.getMonth());
			        String pom3=String.valueOf(data.getYear());
					
					db.open();        
			        long id = db.insertScore("Episode 6",pom1+"."+pom2+"."+pom3.substring(1), pom+"/24");  
			        db.close();
				}
			};			
			btnRez6.setOnClickListener(btnListener6);
			
			OnClickListener btnListener1 = new OnClickListener() {
				
				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					TextView lblSUG = (TextView)findViewById(R.id.lblSUG);
					lblSUG.setText(R.string.answers6);
					TextView lblREZ=(TextView)findViewById(R.id.lblREZ);
					lblREZ.setText("Answers:");
				}
			};			
			btnAns1.setOnClickListener(btnListener1);
		    
		}
	
	}
	
	/*
	 * f-ja za presmetuvanje na rezultatot dobien od testot za lekcija 1
	 */
	public int Rezultat1(){
		int rezultat=0;
		EditText e111=(EditText)findViewById(R.id.txtE1_1_1);
		EditText e112=(EditText)findViewById(R.id.txtE1_1_2);
		EditText e113=(EditText)findViewById(R.id.txtE1_1_3);
		EditText e114=(EditText)findViewById(R.id.txtE1_1_4);
		EditText e115=(EditText)findViewById(R.id.txtE1_1_5);
		EditText e116=(EditText)findViewById(R.id.txtE1_1_6);
		EditText e117=(EditText)findViewById(R.id.txtE1_1_7);
		EditText e118=(EditText)findViewById(R.id.txtE1_1_8);
		
		CheckBox e121=(CheckBox)findViewById(R.id.chbE1_2_1);
		CheckBox e125=(CheckBox)findViewById(R.id.chbE1_2_5);
		CheckBox e126=(CheckBox)findViewById(R.id.chbE1_2_6);
		
		EditText e131=(EditText)findViewById(R.id.txtE1_3_1);
		EditText e132=(EditText)findViewById(R.id.txtE1_3_2);
		EditText e133=(EditText)findViewById(R.id.txtE1_3_3);
		EditText e134=(EditText)findViewById(R.id.txtE1_3_4);
		EditText e135=(EditText)findViewById(R.id.txtE1_3_5);
		
		RadioButton e1411=(RadioButton)findViewById(R.id.rbE1_4_11);
		RadioButton e1422=(RadioButton)findViewById(R.id.rbE1_4_22);
		RadioButton e1431=(RadioButton)findViewById(R.id.rbE1_4_31);
		RadioButton e1443=(RadioButton)findViewById(R.id.rbE1_4_43);
		RadioButton e1453=(RadioButton)findViewById(R.id.rbE1_4_53);
		RadioButton e1462=(RadioButton)findViewById(R.id.rbE1_4_62);
		RadioButton e1471=(RadioButton)findViewById(R.id.rbE1_4_71);
		RadioButton e1481=(RadioButton)findViewById(R.id.rbE1_4_81);
		
		
		if(e111.getText().toString().equals("4")) rezultat++;
		if(e112.getText().toString().equals("7")) rezultat++;
		if(e113.getText().toString().equals("1")) rezultat++;
		if(e114.getText().toString().equals("8")) rezultat++;
		if(e115.getText().toString().equals("3")) rezultat++;
		if(e116.getText().toString().equals("6")) rezultat++;
		if(e117.getText().toString().equals("2")) rezultat++;
		if(e118.getText().toString().equals("5")) rezultat++;
		
		if(e121.isChecked())rezultat++;
		if(e125.isChecked())rezultat++;
		if(e126.isChecked())rezultat++;
		
		if(e131.getText().toString().equals("someone")) rezultat++;
		if(e132.getText().toString().equals("anyone")) rezultat++;
		if(e133.getText().toString().equals("anyone")) rezultat++;
		if(e134.getText().toString().equals("someone")) rezultat++;
		if(e135.getText().toString().equals("anyone")) rezultat++;
		
		if(e1411.isChecked())rezultat++;
		if(e1422.isChecked())rezultat++;
		if(e1431.isChecked())rezultat++;
		if(e1443.isChecked())rezultat++;
		if(e1453.isChecked())rezultat++;
		if(e1462.isChecked())rezultat++;
		if(e1471.isChecked())rezultat++;
		if(e1481.isChecked())rezultat++;	
		
		return rezultat;
	}
	
	/*
	 * f-ja za presmetuvanje na rezultatot dobien od testot za lekcija 2
	 */
	public int Rezultat2(){
		int rezultat=0;
		
		EditText e211=(EditText)findViewById(R.id.txtE2_1_1);
		EditText e212=(EditText)findViewById(R.id.txtE2_1_2);
		EditText e213=(EditText)findViewById(R.id.txtE2_1_3);
		EditText e214=(EditText)findViewById(R.id.txtE2_1_4);
		EditText e215=(EditText)findViewById(R.id.txtE2_1_5);
		EditText e216=(EditText)findViewById(R.id.txtE2_1_6);
		
		EditText e221=(EditText)findViewById(R.id.txtE2_2_1);
		EditText e222=(EditText)findViewById(R.id.txtE2_2_2);
		EditText e223=(EditText)findViewById(R.id.txtE2_2_3);
		EditText e224=(EditText)findViewById(R.id.txtE2_2_4);
		EditText e225=(EditText)findViewById(R.id.txtE2_2_5);
		EditText e226=(EditText)findViewById(R.id.txtE2_2_6);
		
		EditText e231=(EditText)findViewById(R.id.txtE2_3_1);
		EditText e232=(EditText)findViewById(R.id.txtE2_3_2);
		EditText e233=(EditText)findViewById(R.id.txtE2_3_3);
		EditText e234=(EditText)findViewById(R.id.txtE2_3_4);
		EditText e235=(EditText)findViewById(R.id.txtE2_3_5);
		EditText e236=(EditText)findViewById(R.id.txtE2_3_6);
		EditText e237=(EditText)findViewById(R.id.txtE2_3_7);
		EditText e238=(EditText)findViewById(R.id.txtE2_3_8);
		
		RadioButton e2411=(RadioButton)findViewById(R.id.rbE2_4_11);
		RadioButton e2422=(RadioButton)findViewById(R.id.rbE2_4_22);
		RadioButton e2432=(RadioButton)findViewById(R.id.rbE2_4_32);
		RadioButton e2443=(RadioButton)findViewById(R.id.rbE2_4_43);
		RadioButton e2453=(RadioButton)findViewById(R.id.rbE2_4_53);
		RadioButton e2461=(RadioButton)findViewById(R.id.rbE2_4_61);
		RadioButton e2471=(RadioButton)findViewById(R.id.rbE2_4_71);
		RadioButton e2483=(RadioButton)findViewById(R.id.rbE2_4_83);
		
		
		if(e211.getText().toString().equals("Harry")) rezultat++;
		if(e212.getText().toString().equals("likes")) rezultat++;
		if(e213.getText().toString().equals("computer")) rezultat++;
		if(e214.getText().toString().equals("expensive")) rezultat++;
		if(e215.getText().toString().equals("sells")) rezultat++;
		if(e216.getText().toString().equals("father")) rezultat++;
		
		if(e221.getText().toString().equals("f")) rezultat++;
		if(e222.getText().toString().equals("b")) rezultat++;
		if(e223.getText().toString().equals("c")) rezultat++;
		if(e224.getText().toString().equals("a")) rezultat++;
		if(e225.getText().toString().equals("d")) rezultat++;
		if(e226.getText().toString().equals("e")) rezultat++;
		
		if(e231.getText().toString().equals("a job")) rezultat++;
		if(e232.getText().toString().equals("the most of something")) rezultat++;
		if(e233.getText().toString().equals("more")) rezultat++;
		if(e234.getText().toString().equals("football")) rezultat++;
		if(e235.getText().toString().equals("a shop or a business")) rezultat++;
		if(e236.getText().toString().equals("a website")) rezultat++;
		if(e237.getText().toString().equals("a break")) rezultat++;
		if(e238.getText().toString().equals("the truth")) rezultat++;
		
		if(e2411.isChecked())rezultat++;
		if(e2422.isChecked())rezultat++;
		if(e2432.isChecked())rezultat++;
		if(e2443.isChecked())rezultat++;
		if(e2453.isChecked())rezultat++;
		if(e2461.isChecked())rezultat++;
		if(e2471.isChecked())rezultat++;
		if(e2483.isChecked())rezultat++;	
		
		return rezultat;
	}
	
	/*
	 * f-ja za presmetuvanje na rezultatot dobien od testot za lekcija 3
	 */
	public int Rezultat3(){
		int rezultat=0;
		
		CheckBox e312=(CheckBox)findViewById(R.id.chbE3_1_2);
		CheckBox e315=(CheckBox)findViewById(R.id.chbE3_1_5);
		
		EditText e321=(EditText)findViewById(R.id.txtE3_2_1);
		EditText e322=(EditText)findViewById(R.id.txtE3_2_2);
		EditText e323=(EditText)findViewById(R.id.txtE3_2_3);
		EditText e324=(EditText)findViewById(R.id.txtE3_2_4);
		EditText e325=(EditText)findViewById(R.id.txtE3_2_5);
		EditText e326=(EditText)findViewById(R.id.txtE3_2_6);
		
		EditText e331=(EditText)findViewById(R.id.txtE3_3_1);
		EditText e332=(EditText)findViewById(R.id.txtE3_3_2);
		EditText e333=(EditText)findViewById(R.id.txtE3_3_3);
		EditText e334=(EditText)findViewById(R.id.txtE3_3_4);
		EditText e335=(EditText)findViewById(R.id.txtE3_3_5);
		EditText e336=(EditText)findViewById(R.id.txtE3_3_6);
		EditText e337=(EditText)findViewById(R.id.txtE3_3_7);
		EditText e338=(EditText)findViewById(R.id.txtE3_3_8);	
		
		RadioButton e3411=(RadioButton)findViewById(R.id.rbE3_4_11);
		RadioButton e3422=(RadioButton)findViewById(R.id.rbE3_4_22);
		RadioButton e3431=(RadioButton)findViewById(R.id.rbE3_4_31);
		RadioButton e3443=(RadioButton)findViewById(R.id.rbE3_4_43);
		RadioButton e3453=(RadioButton)findViewById(R.id.rbE3_4_53);
		RadioButton e3462=(RadioButton)findViewById(R.id.rbE3_4_62);		
		
		if(e321.getText().toString().equals("a")) rezultat++;
		if(e322.getText().toString().equals("e")) rezultat++;
		if(e323.getText().toString().equals("d")) rezultat++;
		if(e324.getText().toString().equals("c")) rezultat++;
		if(e325.getText().toString().equals("b")) rezultat++;
		if(e326.getText().toString().equals("f")) rezultat++;
		
		if(e312.isChecked())rezultat++;
		if(e315.isChecked())rezultat++;
		
		if(e331.getText().toString().equals("from")) rezultat++;
		if(e332.getText().toString().equals("in")) rezultat++;
		if(e333.getText().toString().equals("on")) rezultat++;
		if(e334.getText().toString().equals("for")) rezultat++;
		if(e335.getText().toString().equals("into")) rezultat++;
		if(e336.getText().toString().equals("at")) rezultat++;
		if(e337.getText().toString().equals("back")) rezultat++;
		if(e338.getText().toString().equals("ahead")) rezultat++;
		
		if(e3411.isChecked())rezultat++;
		if(e3422.isChecked())rezultat++;
		if(e3431.isChecked())rezultat++;
		if(e3443.isChecked())rezultat++;
		if(e3453.isChecked())rezultat++;
		if(e3462.isChecked())rezultat++;	
		
		return rezultat;
	}
	
	/*
	 * f-ja za presmetuvanje na rezultatot dobien od testot za lekcija 4
	 */
	public int Rezultat4(){
		int rezultat=0;
		
		EditText e421=(EditText)findViewById(R.id.txtE4_2_1);
		EditText e422=(EditText)findViewById(R.id.txtE4_2_2);
		EditText e423=(EditText)findViewById(R.id.txtE4_2_3);
		EditText e424=(EditText)findViewById(R.id.txtE4_2_4);
		EditText e425=(EditText)findViewById(R.id.txtE4_2_5);
		EditText e426=(EditText)findViewById(R.id.txtE4_2_6);
		EditText e427=(EditText)findViewById(R.id.txtE4_2_7);
		EditText e428=(EditText)findViewById(R.id.txtE4_2_8);
		
		CheckBox e433=(CheckBox)findViewById(R.id.chbE4_3_3);
		CheckBox e434=(CheckBox)findViewById(R.id.chbE4_3_4);
		CheckBox e436=(CheckBox)findViewById(R.id.chbE4_3_6);
		
		EditText e441=(EditText)findViewById(R.id.txtE4_4_1);
		EditText e442=(EditText)findViewById(R.id.txtE4_4_2);
		EditText e443=(EditText)findViewById(R.id.txtE4_4_3);
		EditText e444=(EditText)findViewById(R.id.txtE4_4_4);
		EditText e445=(EditText)findViewById(R.id.txtE4_4_5);
		EditText e446=(EditText)findViewById(R.id.txtE4_4_6);
		
		if(spREZ1.equals("Sarah")) rezultat++;
		if(spREZ2.equals("Olivia")) rezultat++;
		if(spREZ3.equals("Fadi")) rezultat++;
		if(spREZ4.equals("Olivia")) rezultat++;
		if(spREZ5.equals("Magda")) rezultat++;
		if(spREZ6.equals("Sarah")) rezultat++;
		
		if(e421.getText().toString().equals("7")) rezultat++;
		if(e422.getText().toString().equals("5")) rezultat++;
		if(e423.getText().toString().equals("3")) rezultat++;
		if(e424.getText().toString().equals("2")) rezultat++;
		if(e425.getText().toString().equals("4")) rezultat++;
		if(e426.getText().toString().equals("8")) rezultat++;
		if(e427.getText().toString().equals("1")) rezultat++;
		if(e428.getText().toString().equals("6")) rezultat++;
		
		if(e433.isChecked())rezultat++;
		if(e434.isChecked())rezultat++;
		if(e436.isChecked())rezultat++;
		
		if(e441.getText().toString().equals("What's the problem with your flat?")) rezultat++;
		if(e442.getText().toString().equals("I know how expensive life is.")) rezultat++;
		if(e443.getText().toString().equals("I'm not only interested in money.")) rezultat++;
		if(e444.getText().toString().equals("He's not a very sensitive guy, is he?")) rezultat++;
		if(e445.getText().toString().equals("Could you do that for me?")) rezultat++;
		if(e446.getText().toString().equals("We'll try and help you find a flat.")) rezultat++;
				
		return rezultat;
	}
	
	/*
	 * f-ja za presmetuvanje na rezultatot dobien od testot za lekcija 5
	 */
	public int Rezultat5(){
		int rezultat=0;
		
		EditText e511=(EditText)findViewById(R.id.txtE5_1_1);
		EditText e512=(EditText)findViewById(R.id.txtE5_1_2);
		EditText e513=(EditText)findViewById(R.id.txtE5_1_3);
		EditText e514=(EditText)findViewById(R.id.txtE5_1_4);
		EditText e515=(EditText)findViewById(R.id.txtE5_1_5);
		EditText e516=(EditText)findViewById(R.id.txtE5_1_6);
		
		RadioButton e5211=(RadioButton)findViewById(R.id.rbE5_2_11);
		RadioButton e5221=(RadioButton)findViewById(R.id.rbE5_2_21);
		RadioButton e5232=(RadioButton)findViewById(R.id.rbE5_2_32);
		RadioButton e5242=(RadioButton)findViewById(R.id.rbE5_2_42);
		RadioButton e5251=(RadioButton)findViewById(R.id.rbE5_2_51);
		RadioButton e5261=(RadioButton)findViewById(R.id.rbE5_2_61);
				
		EditText e531=(EditText)findViewById(R.id.txtE5_3_1);
		EditText e532=(EditText)findViewById(R.id.txtE5_3_2);
		EditText e533=(EditText)findViewById(R.id.txtE5_3_3);
		EditText e534=(EditText)findViewById(R.id.txtE5_3_4);
		EditText e535=(EditText)findViewById(R.id.txtE5_3_5);
		EditText e536=(EditText)findViewById(R.id.txtE5_3_6);
		EditText e537=(EditText)findViewById(R.id.txtE5_3_7);
		EditText e538=(EditText)findViewById(R.id.txtE5_3_8);
		
		EditText e541=(EditText)findViewById(R.id.txtE5_4_1);
		EditText e542=(EditText)findViewById(R.id.txtE5_4_2);
		EditText e543=(EditText)findViewById(R.id.txtE5_4_3);
		EditText e544=(EditText)findViewById(R.id.txtE5_4_4);
		EditText e545=(EditText)findViewById(R.id.txtE5_4_5);
		EditText e546=(EditText)findViewById(R.id.txtE5_4_6);
		EditText e547=(EditText)findViewById(R.id.txtE5_4_7);		
		
		if(e511.getText().toString().equals("an informal")) rezultat++;
		if(e512.getText().toString().equals("good")) rezultat++;
		if(e513.getText().toString().equals("everything")) rezultat++;
		if(e514.getText().toString().equals("will")) rezultat++;
		if(e515.getText().toString().equals("tired")) rezultat++;
		if(e516.getText().toString().equals("strange")) rezultat++;
		
		if(e5211.isChecked())rezultat++;
		if(e5221.isChecked())rezultat++;
		if(e5232.isChecked())rezultat++;
		if(e5242.isChecked())rezultat++;
		if(e5251.isChecked())rezultat++;
		if(e5261.isChecked())rezultat++;
		
		if(e531.getText().toString().equals("a")) rezultat++;
		if(e532.getText().toString().equals("e")) rezultat++;
		if(e533.getText().toString().equals("d")) rezultat++;
		if(e534.getText().toString().equals("f")) rezultat++;
		if(e535.getText().toString().equals("c")) rezultat++;
		if(e536.getText().toString().equals("g")) rezultat++;
		if(e537.getText().toString().equals("h")) rezultat++;
		if(e538.getText().toString().equals("b")) rezultat++;
		
		if(e541.getText().toString().equals("5")) rezultat++;
		if(e542.getText().toString().equals("3")) rezultat++;
		if(e543.getText().toString().equals("4")) rezultat++;
		if(e544.getText().toString().equals("7")) rezultat++;
		if(e545.getText().toString().equals("1")) rezultat++;
		if(e546.getText().toString().equals("6")) rezultat++;
		if(e547.getText().toString().equals("2")) rezultat++;			
		
		return rezultat;
	}
	
	
	/*
	 * f-ja za presmetuvanje na rezultatot dobien od testot za lekcija 6
	 */
	public int Rezultat6(){
		int rezultat=0;
		
		EditText e611=(EditText)findViewById(R.id.txtE6_1_1);
		EditText e612=(EditText)findViewById(R.id.txtE6_1_2);
		EditText e613=(EditText)findViewById(R.id.txtE6_1_3);
		EditText e614=(EditText)findViewById(R.id.txtE6_1_4);
		EditText e615=(EditText)findViewById(R.id.txtE6_1_5);
		EditText e616=(EditText)findViewById(R.id.txtE6_1_6);
		
		EditText e631=(EditText)findViewById(R.id.txtE6_3_1);
		EditText e632=(EditText)findViewById(R.id.txtE6_3_2);
		EditText e633=(EditText)findViewById(R.id.txtE6_3_3);
		EditText e634=(EditText)findViewById(R.id.txtE6_3_4);
		EditText e635=(EditText)findViewById(R.id.txtE6_3_5);
		EditText e636=(EditText)findViewById(R.id.txtE6_3_6);
		EditText e637=(EditText)findViewById(R.id.txtE6_3_7);
		EditText e638=(EditText)findViewById(R.id.txtE6_3_8);
		
		EditText e641=(EditText)findViewById(R.id.txtE6_4_1);
		EditText e642=(EditText)findViewById(R.id.txtE6_4_2);
		EditText e643=(EditText)findViewById(R.id.txtE6_4_3);
		EditText e644=(EditText)findViewById(R.id.txtE6_4_4);
		EditText e645=(EditText)findViewById(R.id.txtE6_4_5);
		EditText e646=(EditText)findViewById(R.id.txtE6_4_6);
				
		if(e611.getText().toString().equals("aunt")) rezultat++;
		if(e612.getText().toString().equals("badly")) rezultat++;
		if(e613.getText().toString().equals("four")) rezultat++;
		if(e614.getText().toString().equals("doesn't want")) rezultat++;
		if(e615.getText().toString().equals("more than")) rezultat++;
		if(e616.getText().toString().equals("bad")) rezultat++;
		
		if(spREZ1.equals("Joe")) rezultat++;
		if(spREZ2.equals("Magda")) rezultat++;
		if(spREZ3.equals("Fadi")) rezultat++;
		if(spREZ4.equals("Harry")) rezultat++;
		
		if(e631.getText().toString().equals("lovely")) rezultat++;
		if(e632.getText().toString().equals("slow")) rezultat++;
		if(e633.getText().toString().equals("old")) rezultat++;
		if(e634.getText().toString().equals("later")) rezultat++;
		if(e635.getText().toString().equals("happy")) rezultat++;
		if(e636.getText().toString().equals("energetic")) rezultat++;
		if(e637.getText().toString().equals("higher")) rezultat++;
		if(e638.getText().toString().equals("quiet")) rezultat++;	
		
		if(e641.getText().toString().equals("look")) rezultat++;
		if(e642.getText().toString().equals("slow")) rezultat++;
		if(e643.getText().toString().equals("Come")) rezultat++;
		if(e644.getText().toString().equals("turn")) rezultat++;
		if(e645.getText().toString().equals("bail")) rezultat++;
		if(e646.getText().toString().equals("Sit")) rezultat++;
		
		return rezultat;
	}


	@Override
	/*
	 * kreiranje na meni
	 */
	public boolean onCreateOptionsMenu(Menu menu) {
		// TODO Auto-generated method stub
		super.onCreateOptionsMenu(menu);
		menu.add(0, Menu.FIRST, 0, "Back");
		menu.add(0, Menu.FIRST+1, 1, "Scores");		
		return true;
	}


	@Override
	/*
	 * postavuvanje na f-cii pri izbiranje na nekoe kopce od menito
	 */
	public boolean onOptionsItemSelected(MenuItem item) {
		// TODO Auto-generated method stub
		super.onOptionsItemSelected(item);
		
		switch (item.getItemId()) {
		case (Menu.FIRST):{
			finish();
			return true;
		}
		case (Menu.FIRST+1):{
			Intent intent = new Intent(this,Rezultati.class);	    	
			startActivity(intent);
		}
		default:
			break;
		}
		
		return false;
	}

}
